package com.hangxin.basic.util;

import java.io.File;

import javax.imageio.stream.FileImageOutputStream;

import sun.misc.BASE64Decoder;

public class Test {

	public static void main(String[] args) throws Throwable {

	    String str = "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAYAFQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD1q2t9L/sWya306xW9TT4D9olsPPgd3XBD/dBkUqWKhw2MZI3Cuo1fRdBjktof7IsQ7uD+4gTzF6nO3ady8HOfyNY9lbI9r4bR5P3dxaW3mIeAcIAOnOTkjJ9evpS/aD0rUdX+H89tojyteu6Rvb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kokOj6jpSQvNJNdOk7SyyM7ZeWR3aRmbk/O5445wBjY1dvDmpS6erajYPb20kUrCO7yw8l1kiztONodFJLccDJoooA5vWtI8Myax4dv4r62u7rSYnWO5NyZ2iDALJJJlzvLA8l8njrWV8YdMTxr4Y1zRtJ1fTTNdPARcT3HlwpiRGG5l3DAVSBwCS3eiigDmPg14JbwYurNc K7DUoDI1vY7ZXiMccMkpGA4 XLyO5C5UD5t5Dhq9S8Qf8I7qUMVtcXVnd6dLbSWt5DHdCULCykHkMGAwzfMOnGOwoooA5zRfDXg7w9r5fQ7m2kuBFHBCZ7qSdEg34SFJZGYYDHJjQ/dAJxla6XULzTnvbOdr60m8lvLugJFZsRtguwznBA9OOOaKKAPPPjV4j0P8A4Sq1/wCJzpv/AB5J/wAvSf35PeiiigD/2Q==";
		BASE64Decoder decoder = new BASE64Decoder();
        if(str.equals(str1)){
        	System.out.println("yiyang1");
        }else{
        	System.out.println("buyiyang");
        }
        // Base64解码
        byte[] b = decoder.decodeBuffer(str);
        for (int i = 0; i < b.length; ++i) {
                if (b[i] < 0) {// 调整异常数据
                        b[i] += 256;
                }
        }
        File file = new File("D:/test.jpeg");
        if(file.exists()) file.delete();
        FileImageOutputStream fileImageOutputStream = new FileImageOutputStream(file);
        fileImageOutputStream.write(b);
        fileImageOutputStream.flush();
        fileImageOutputStream.close();
        System.out.println("ok");
		
	}
}
